function init() {
    if (window.Event) {
    document.captureEvents(Event.MOUSEMOVE);
    }
    document.onmousemove = getCursorXY;
}

function getCursorXY(e) {
   posx= (window.Event) ? e.pageX : event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
   posy= (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
 return [posx,posy];
}

 var links=new Array(1001);
 //links[1]="0*0*Test.";

  function deletediv2()
 {
  var deldiv2=document.getElementById("div2");
  deldiv2.parentNode.removeChild(deldiv2);
  click=0;
  return click;
 }

 
function n(obj,number)
	{
		obj.style.background="#808080"; 
		obj.style.color="#f5f5f5";
		obj.style.fontWeight = "bold";
		var thisid=obj.id;
		var numoffsetleft=document.getElementById(thisid).offsetLeft;
		var numoffsettop=document.getElementById(thisid).offsetTop;
		if(document.all)
		{
			numoffsetleft=obj.offsetLeft // IE only
			numoffsettop=obj.offsetTop // IE only
		}
		if(numoffsetleft > 520){posx=posx-495;}
		if(numoffsettop > 650){posy=posy-235;}
		var thisidnum=parseInt(obj.id);
		var splitthis="";
		var needsell=1000;
		var soldlinks=0;
		var solddollar=0;  
                submitstory="<b>Free to submit your business idea in this number.</b><br/><br/>";
		if(links[thisidnum] !=undefined)
		{
			var splitthis = links[thisidnum].split("*");
			soldlinks= parseInt(splitthis[1]);
			solddollar=parseInt(splitthis[0]);
			needsell=1000-parseInt(splitthis[0]);
			introword=(needsell/100)*15;
			if(solddollar == -1)
			{
				obj.style.background="darkorange"; 
				obj.style.color="black";
				obj.style.fontWeight = "bold";
				
			}
			else
			{
				if(needsell == 100)
				{
					topoffer="";
				}
				else
				{
					topoffer="<b>Your link here: $</b>" +"<b>" + needsell + ".</b>" + " The number <span style='background:yellow;'>finish selling</span>, you have +<span style='background:yellow;'>" + introword + " word</span> of <span style='background:yellow;'>introduction text</span> of your site  and<span style='background:yellow;'>no other links can be add more.</span> The <span style='background:yellow;'>position</span> of your link may be <span style='background:yellow;'>raised.</span><br/>";
				}
				offer= topoffer + "<b>Your link here: $100.</b> If you <span style='background:yellow;'>pay more $100</span> for your link, you have<span style='background:yellow;'> +15 word</span> of <span style='background:yellow;'>introduction text</span> of your site and the <span style='background:yellow;'>quantity of link</span> in a number will be <span style='background:yellow;'>decreased 1</span>.";
				if(solddollar < 1000)
				{
					theselinks= submitstory + splitthis[2] + offer;
				}
				else
				{
					theselinks= submitstory + splitthis[2];
				}
			}

          
		}
		else
		{
				theselinks= submitstory + "<b>Buy this number: $</b>" +"<b>" + needsell+ ".</b>" + " This number has total 1 link and <span style='background:yellow;'>links directly to your site</span>. You will not share number with anyone.<br/>You can submit <span style='background:yellow;'>180 words</span> of <span style='background:yellow;'>introduction text</span> and an <span style='background:yellow;'>image</span> of your site. The size of image is max 100x100px. Your link has <span style='background:yellow;'>mouseover effect</span>: when the mouse of visitor hover your link, your link will immediately appear.<br/><b>Buy a link: $100.</b> This number has max 10 links. You share number with max 9 other people. If you <span style='background:yellow;'>pay more $100</span> for your link, you have<span style='background:yellow;'> +15 word</span> of <span style='background:yellow;'>introduction text</span> of your site and the <span style='background:yellow;'>quantity of link</span> in a number will be <span style='background:yellow;'>decreased 1</span>.";
		}
		var deldiv2=document.getElementById('div2');
		if(deldiv2 !=undefined)
		{
			deldiv2.parentNode.removeChild(deldiv2);
		};
        var divTag2 = document.createElement("div"); 
		divTag2.id = "div2";
		divTag2.style.top= posy + 45 + "px";
		divTag2.style.left= posx + 20 + "px";
		divTag2.className ="links";
		divTag2.innerHTML ="<table cellpadding='0' cellspacing='0' style='width:100%;height:100%;background:whitesmoke;border:0px;'><tr><td style='margin:0;padding:0px;border:2px solid cadetblue;'><p style='margin:0;padding-top:3px;width:100%;height:21px;background:url(https://lh3.googleusercontent.com/-7YH6Ng9Fjmw/TgMsNvxps6I/AAAAAAAAA58/7j9bV0Q9v-o/nav1.gif);font-size:15px;font-weight:bold;color:#444;'><span style='float:left;margin-left:2px;'>Number: " + thisidnum + "</span><span style='float:left;margin-left:10px;'>Sold: $" + solddollar + "</span><span style='float:left;margin-left:10px;'>Task: " + "$1000</span>"+ "<span style='float:left;margin-left:10px;'>Max link: 10</span>" + "<a href='javascript:void(0)' id='closelink' onclick='deletediv2();' style='float:right;margin-right:10px;color:#444;'><b>Close</b></a></p>" + "<p style='margin:0;padding:8px;'>" + theselinks + "</p></td></tr></table>";
		document.body.appendChild(divTag2);
	}